package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.exception.RequestIllegalException;
import com.frogs.system.web.api.request.Request;

/**
 * 赞/踩-请求参数类
 *
 * @author lijian
 * @version 2014年3月17日 - 下午8:03:07
 */
public class GoodsEvaluateIsPraiseRequest extends Request {

	/**
	 * 账号ID
	 */
	private int userId;
	/**
	 * 商品评价ID
	 */
	private int goodsEvaluateId;
	/**
	 * 赞/踩<br>
	 * 0：踩，1：赞
	 */
	private int isPraise;
	
	/** */
	public GoodsEvaluateIsPraiseRequest() {
		
	}
	
	/**
	 * 
	 */
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		this.goodsEvaluateId = requestInfo.getIntParameter(ApiUrlParamEnum.goodsEvaluateId.getParamName(), 0);
		this.isPraise = requestInfo.getIntParameter(ApiUrlParamEnum.isPraise.getParamName(), 0);
		this.userId = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(), 0);
		if (userId < 1) {
			throw new RequestIllegalException("error userId: " + userId);
		}
		if (goodsEvaluateId < 1) {
			throw new RequestIllegalException("error goodsEvaluateId: " + goodsEvaluateId);
		}
		if (isPraise != 0 && isPraise != 1) {
			throw new RequestIllegalException("error isPraise: " + isPraise);
		}
	}

	public int getUserId() {
		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	public int getGoodsEvaluateId() {
		return goodsEvaluateId;
	}

	public void setGoodsEvaluateId(int goodsEvaluateId) {
		this.goodsEvaluateId = goodsEvaluateId;
	}

	public int getIsPraise() {
		return isPraise;
	}

	public void setIsPraise(int isPraise) {
		this.isPraise = isPraise;
	}
	
}
